package stark.app.function.idiom;

import com.blankj.utilcode.util.ToastUtils;
import com.stark.idiom.lib.IdiomModule;
import com.stark.idiom.lib.ui.IdiomCollectActivity;
import com.stark.idiom.lib.ui.IdiomDicFragment;
import com.stark.idiom.lib.ui.IdiomGuessActivity;
import com.stark.idiom.lib.ui.IdiomPyActivity;
import com.stark.idiom.lib.ui.IdiomRemoveActivity;
import com.stark.idiom.lib.ui.IdiomSelPassActivity;

import stark.app.R;
import stark.app.base.BaseWithFragmentActivity;
import stark.app.databinding.ActivityIdiomDemoBinding;
import stark.common.basic.base.BaseNoModelActivity;

/**
 * Author：daizhongbin on 2021/11/1
 * Email：1027154338@qq.com
 * Desc: 成语功能使用demo界面
 */
public class IdiomDemoActivity extends BaseNoModelActivity<ActivityIdiomDemoBinding> {
    @Override
    protected int onCreate() {
        return R.layout.activity_idiom_demo;
    }

    @Override
    protected void initView() {
        showDialog("初始化中...");
        IdiomModule.init(new IdiomModule.InitCallback() {
            @Override
            public void onInit(boolean success) {
                dismissDialog();
                ToastUtils.showShort(success ? "初始化成功" : "初始化失败");
            }
        });

        mDataBinding.btnDic.setOnClickListener(v -> {
            BaseWithFragmentActivity.start(this, "成语词典", IdiomDicFragment.class);
        });
        mDataBinding.btnCollect.setOnClickListener(v -> {
            startActivity(IdiomCollectActivity.class);
        });
        mDataBinding.btnIdiomRm.setOnClickListener(v -> {
            startActivity(IdiomRemoveActivity.class);
        });
        mDataBinding.btnIdiomGuess.setOnClickListener(v -> {
            startActivity(IdiomGuessActivity.class);
        });
        mDataBinding.btnIdiomPy.setOnClickListener(v -> {
            startActivity(IdiomPyActivity.class);
        });
        mDataBinding.btnIdiomPp.setOnClickListener(v -> {
            IdiomSelPassActivity.selPjPass(this);
        });
        mDataBinding.btnIdiomErr.setOnClickListener(v -> {
            IdiomSelPassActivity.selErrPass(this);
        });
        mDataBinding.btnIdiomXx.setOnClickListener(v -> {
            startActivity(IdiomXxActivity.class);
        });
    }

    @Override
    protected void initData() {
    }

}
